//
//  PdTableViewCell.m
//  Koala_Fm
//
//  Created by dllo on 16/2/26.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "PdTableViewCell.h"

@implementation PdTableViewCell
- (void)dealloc
{
    [_image release];
    [_lable release];
    [_smallImage release];
    [_name release];
    [_splendor release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        //
        self.smallImage = [[UIImageView alloc]init];
//        self.smallImage.backgroundColor = [UIColor greenColor];
        [self.contentView addSubview:_smallImage];
        [_smallImage release];
        //
        self.name = [[UILabel alloc]init];
//        self.name.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_name];
        [_name release];
        //
        self.splendor = [[UILabel alloc]init];
//        self.splendor.backgroundColor = [UIColor blueColor];
        [self.contentView addSubview:_splendor];
        [_splendor release];
        //
        self.redImage = [[UIImageView alloc]init];
//        self.redImage.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:_redImage];
        [_redImage release];
        
        
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    _smallImage.frame = CGRectMake(10, 10, 80, 80);
    _name.frame = CGRectMake(100, 35, self.contentView.frame.size.width - 100, 30);
    
}

// 文字自适应高度
+(CGFloat)heightWithText:(NSString *)text{
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:17]};
    CGSize size = CGSizeMake(355, 1000);
    CGRect rect = [text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return rect.size.height;
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
